package com.kgc.jy91.springboot1.controller;

import com.kgc.jy91.springboot1.autoConfiguration.SayHello;
import com.kgc.jy91.springboot1.autoConfiguration.SayHelloProperties;
import com.kgc.jy91.springboot1.pojo.Student;
import com.kgc.jy91.springboot1.pojo.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*RestController =Controller+ Responsebody*/
@RestController
@RequestMapping("/user")
public class userController {
    @Autowired
    Student student;

    @Autowired
    Teacher th;

    @Autowired
    SayHello sayHello;

    @Autowired
    SayHelloProperties sayHelloProperties;


    @RequestMapping("/hello")
    public String say(){
        return sayHelloProperties.getHelloMsg();

    }

    @RequestMapping("/sayHello")
    public String sayHello(){
       return  "hello springboot"+ student.getName();

    }
    @RequestMapping("/thHello")
    public String thHello(){
        return  "hello springboot"+ th.getName()+th.getAge();

    }

    @RequestMapping("/autoconfig")
    public String autoConfig(){
        return   sayHello.sayHello();

    }

    @RequestMapping("/autoconfigtest")
    public String autoConfigtest(){
        return   sayHello.sayHello();

    }


}
